import request from '@/utils/request'

/**
 * 
 * 查询铁路运单列表
 * @param {} data 
 * @returns 
 */
export function getListApi(data) {
  return request({
    url: '/web/railway/consignment/list',
    method: 'post',
    data
  })
}


/**
 * 
 * 查询铁路运单列表
 * @param {} data 
 * @returns 
 */
export function getHistoryListApi(data) {
  return request({
    url: '/web/waybill/import/history/list',
    method: 'post',
    data
  })
}


/**
 * 
 * 请车数据excle导入
 * @param {} data 
 * @returns 
 */
export function importFileApi(data) {
  return request({
    url: '/web/railway/consignment/upload',
    method: 'post',
    data
  })
}

/**
 * 
 * 更新铁路运单列表
 * @param {} data 
 * @returns 
 */
export function updateListApi(data) {
  return request({
    url: '/web/railway/consignment/update',
    method: 'post',
    data
  })
}


/**
 * 查询拉运详情
 * @param {}  
 * @returns 
 */
export function getWeightbillInfoApi(id) {
  return request({
    url: `/haul/weightbill/info?haulId=${id}`,
    method: 'get',
  })
}


/**
 * 查询审核信息
 * @param {}  
 * @returns 
 */
export function transportInfoApi(id) {
  return request({
    url: `/haul/${id}`,
    method: 'get'
  })
}

/**
 * 提交审核信息
 * @param {} 
 * @returns 
 */
export function checkHaulApi(data) {
  return request({
    url: '/web/haul/check',
    method: 'post',
    data
  })
}

/**
 * 编辑审核信息
 * @param {} 
 * @returns 
 */
export function updateHaulApi(data) {
  return request({
    url: '/web/haul/update',
    method: 'post',
    data
  })
}


/**
 * 匹配数据
 */
export function matchDataApi(data) {
  return request({
    url: '/web/railway/consignment/match',
    method: 'post',
    data
  })
}

/** 导入匹配数据 */
export function importMatchDataApi(data) {
  return request({
    url: '/web/railway/consignment/import',
    method: 'post',
    data
  })
}


/** 导出数据 */
export function exportExcleApi(data) {
  return request({
    url: '/web/railway/consignment/export',
    method: 'post',
    responseType: 'blob',
    data
  })
}

/** 导出匹配结果 */
export function exportMatchDataApi(data) {
  return request({
    url: '/web/railway/consignment/match/export',
    method: 'post',
    responseType: 'blob',
    data
  })
}

// 查询角色详细
export function getRole(roleId) {
  return request({
    url: '/system/role/' + roleId,
    method: 'get'
  })
}

// 新增角色
export function addRole(data) {
  return request({
    url: '/system/role',
    method: 'post',
    data: data
  })
}

// 修改角色
export function updateRole(data) {
  return request({
    url: '/system/role',
    method: 'put',
    data: data
  })
}

// 角色数据权限
export function dataScope(data) {
  return request({
    url: '/system/role/dataScope',
    method: 'put',
    data: data
  })
}

// 角色状态修改
export function changeRoleStatus(roleId, status) {
  const data = {
    roleId,
    status
  }
  return request({
    url: '/system/role/changeStatus',
    method: 'put',
    data: data
  })
}

// 删除角色
export function delRole(roleId) {
  return request({
    url: '/system/role/' + roleId,
    method: 'delete'
  })
}

// 查询角色已授权用户列表
export function allocatedUserList(query) {
  return request({
    url: '/system/role/authUser/allocatedList',
    method: 'get',
    params: query
  })
}

// 查询角色未授权用户列表
export function unallocatedUserList(query) {
  return request({
    url: '/system/role/authUser/unallocatedList',
    method: 'get',
    params: query
  })
}

// 取消用户授权角色
export function authUserCancel(data) {
  return request({
    url: '/system/role/authUser/cancel',
    method: 'put',
    data: data
  })
}

// 批量取消用户授权角色
export function authUserCancelAll(data) {
  return request({
    url: '/system/role/authUser/cancelAll',
    method: 'put',
    params: data
  })
}

// 授权用户选择
export function authUserSelectAll(data) {
  return request({
    url: '/system/role/authUser/selectAll',
    method: 'put',
    params: data
  })
}

// 根据角色ID查询部门树结构
export function deptTreeSelect(roleId) {
  return request({
    url: '/system/role/deptTree/' + roleId,
    method: 'get'
  })
}

